package cn.tedu.sp02.service;

import cn.tedu.sp01.entity.Item;
import cn.tedu.sp01.service.ItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 金帮嘉诚 @date 2021-09-09 星期四 11:42
 */
@Slf4j
@Service
public class ItemServiceImpl implements ItemService {

    public List<Item> getItems(String orderId){
        log.info("获取商品 orderId = "+orderId);
        List<Item> items = new ArrayList<>();
        items.add(new Item(1,"商品01",1));
        items.add(new Item(2,"商品10",22));
        items.add(new Item(3,"商品11",33));
        items.add(new Item(4,"商品100",44));
        items.add(new Item(5,"商品101",55));
        return items;
    }

    @Override
    public void decreaseNumber(List<Item> items) {
        for(Item item : items) {
            log.info("减少库存 - "+item);
        }

    }
}
